#coding:utf-8
from django.template import RequestContext
from django.http import HttpResponse,HttpResponseRedirect
from django.shortcuts import render
import json

import common.httpclient as http
import config.myurls as myurls


def getCategoryByName(cn,req):
  '获取分类，返回python对象'
  param=[];
  param.append(("category_name",cn))
  
  url=myurls.ApiGetwebcategory;
  
  rt=[]
  category=[]
  try:
    rt=json.loads(http.getDateByUrlAndAdminId(url,req,param))
    category=rt['category']
  except HTTPError:
    pass
  
  return category